import config from './config.js'
export default (url, data, method = 'POST') => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: config.host + url,
			data,
			method,
			success: res => resolve(res.data),
			timeout: 5000,
			fail: err => {
				uni.showToast({
					title: "请求失败",
					icon: "error",
					mask: true,
				});
				reject(err.message)
			}
		})
	})
}
